<template>
  <div>
    <div class="container" @click="handleBannerClick">
      <div class="img">
        <img class="img-content" :src="banner">
      </div>
      <div class="info">
        <div class="title">东部华侨城大侠谷</div>
        <div class="num">
          <span class="iconfont info-icon">&#xe67b;</span>
          {{imgNum}}
        </div>
      </div>
    </div>
    <fade-animation>
      <common-gallary :imgs="gallary" @cancel="handleBannerCancel" v-show="showGallary" />
    </fade-animation>
  </div>
</template>

<script>
import CommonGallary from '../../../common/gallary/Gallary'
import FadeAnimation from '../../../common/fade/FadeAnimation'
export default {
  name: 'DetailBanner',
  props: {
    banner: String,
    gallary: Array
  },
  components: {
    CommonGallary,
    FadeAnimation
  },
  data () {
    return {
      showGallary: false
    }
  },
  computed: {
    imgNum () {
      return this.gallary.length
    }
  },
  methods: {
    handleBannerClick () {
      this.showGallary = true
    },
    handleBannerCancel () {
      this.showGallary = false
    }
  }
}
</script>

<style lang="stylus" scoped>
  .container
    width 100%
    position relative
    overflow hidden
    .img
      width 100%
      height 0
      padding-bottom 55%
      .img-content
        width 100%
    .info
      height .66rem
      line-height .42rem
      padding .1rem .3rem 0 .3rem
      font-size .36rem
      color #ffffff
      display flex
      flex-direction row
      position absolute
      left 0
      right 0
      bottom 0
      background-image linear-gradient(to bottom,rgba(0,0,0,0),rgba(0,0,0,.8))
      .title
        height .42rem
        line-height .42rem
        flex 1
      .num
        height .42rem
        line-height .42rem
        font-size .26rem
        padding 0 .26rem
        display flex
        align-items baseline
        background rgba(0, 0, 0, .5)
        border-radius .42rem
        .info-icon
          margin-right .1rem
          font-size .26rem
</style>
